home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / web / noweb / contrib / leew / strhack.nw (.txt) < prev   
LaTeX Document  |  1995-02-24  |  954b  |  28 lines

  1. \documentstyle[11pt,noweb]{article}
  2. \noweboptions{longchunks,noidentxref,smallcode}
  3. \pagestyle{noweb}
  4. \def\noweb/{{\tt noweb}}
  5. \title{A Hack for Typesetting Strings in \noweb/\thanks{This
  6. code is hereby placed in the public domain.}}
  7. \author{Lee Wittenberg\\Kean College of New Jersey\\Union, NJ
  8. 07083\\\tt leew@pilot.njin.net}
  9. \begin{document}
  10. \maketitle
  11. The following macros adjust things so that \noweb/ will use 
  12. ``visible spaces'' in double-quoted strings within code chunks. 
  13. The same effect can be 
  14. achieved for single-quoted strings by replacing each occurrence 
  15. of `[["]]', below, with `[[']]'.
  16. It doesn't work within \verb"[["~\ldots~\verb"]]" (although I 
  17. can't figure out why).
  18. <<*>>=
  19. \global\let\xsetup=\setupcode
  20. \bgroup
  21.     \catcode`\"=\active\gdef\setupcode{\xsetup
  22.     \catcode`\"=\active\def"##1"{\char`\"\xxx{##1}\char`\"}}%
  23. \egroup
  24. \bgroup
  25.     \catcode`\ =\active\gdef\xxx#1{{\catcode`\ =\active\chardef ='40#1}}%
  26. \egroup
  27. \end{document}
  28.